****************************************************************************
*** Replication code for "Algorithmic Aversion? Experimental Evidence on ***
*** the Elasticity of Public Attitudes to "Killer Robots" by Ondrej      ***
*** Rosendorf, Michal Smetana, and Marek Vranka                          ***
****************************************************************************

*** Instructions for replication ***

* The code was written in Stata 17.0 BE-Basic Edition
* Please reach out to ondrej.rosendorf@fsv.cuni.cz if you have any questions concerning this replication file
* IMPORTANT: This file is accompanied by the ss_replication_data2 dataset
* Before proceeding with the replication, please make sure that the "asdoc", "betterbar", "catplot", "coefplot" and "estout" package is installed

* To install the asdoc package, use the following command
ssc install asdoc, replace

* To install the betterbar package, use the following command
ssc install betterbar, replace

* To install the catplot package, use the following command
ssc install catplot, replace

* To install the asdoc package, use the following command
ssc install coefplot, replace

* To install the estout package, use the following command
ssc install estout, replace

* Setting the output scheme to black and white
set scheme s1mono

***************************************************
*** Replication of the results in the main text ***
***************************************************

*** Figure 1 (bar graph) - LAWS preference across experimental groups (control, equal risk, unequal risk, highly unequal risk) ***

* Generating a labelled version of the group variable
recode group (1=1 "Control") (2=2 "Equal risk") (3=3 "Equal risk + responsibility") (4=4 "Unequal risk") (5=5 "Highly unequal risk"), generate(group_label)

* Generating a percent version of the preference variable
recode preference (0=0) (1=100), generate(preference_percent)

* Generating a bar graph with error bars
* Note: the "if group!=3" command filters out the "equal risk + responsibility" group
betterbarci preference_percent if group!=3, over(group_label) bar format(%2.0f) vertical ytitle("% prefer LAWS") ylabel(0(20)80, labsize(small)) xlabel("")

* Exporting the bar graph (Figure 1)
graph export F01.png

*** Figure 2 (coefplot) - logistic regression of LAWS preference (DV), experimental treatments (IVs) ***

* Running the logistic regression (equal risk - control)
logistic preference group_filter1

* Storing the estimates
estimates store A

* Running the logistic regression (unequal risk - equal risk)
logistic preference group_filter2

* Storing the estimates
estimates store B

* Running the logistic regression (highly unequal risk - unequal risk)
logistic preference group_filter3

* Storing the estimates
estimates store C

* Generating a coefficient plot
* Note 1: By default, coefplot displays raw coefficients, the "eform" command transforms the raw log odds to odds ratios
* Note 2: The X line is set to 1 to reflect the transformation to odds ratios  
coefplot A B C, pstyle(p1) xline(1) xlabel(0(2)18) eform  xtitle(Odds ratio) drop(_cons) coeflabels(group_filter1 = "Equal risk – Control" group_filter2 = "Unequal risk – Equal risk" group_filter3 = "Highly unequal risk – Unequal risk", wrap(20)) byopts(row(1)) grid(between glpattern(line) glwidth(*.75) glcolor(black)) legend(off) mlabposition(1) mlabel(cond(@pval<.001, "***", cond(@pval<.01, "**", cond(@pval<.05, "*", cond(@pval<.1, "+", ""))))) note("+ p < .1, * p < .05, ** p < .01, *** p < .001")

* Exporting the bar graph (Figure 2)
graph export F02.png

*** Figure 3 (marginsplot) - predictive margins of risk estimate difference (IV) on LAWS preference (DV) ***

* Please refer to files rsv_ss_replication_data2 rsv_ss_replication_code2

*** Figure 4 (bar graph) - LAWS preference across experimental groups (equal risk, equal risk + responsibility) ***

* Generating a bar graph with error bars
betterbarci preference_percent if group!=1 & group!=4 & group!=5, over(group_label) bar format(%2.0f) vertical ytitle("% prefer LAWS") ylabel(0(10)30, labsize(small)) xlabel("")

* Exporting the bar graph (Figure 4)
graph export F04.png

*** Figure 5 (catplot) - perceived differences in legal accountability and moral responsibility ***

* Please refer to files rsv_ss_replication_data3 rsv_ss_replication_code3

*** Figure 6 (coefplot) - logistic regression of LAWS preference (DV), human dignity concern (IV) ***

* Running the logistic regression (Model 1)
logistic preference human_dignity_concern 

* Storing the estimates
estimates store D

* Running the logistic regression (Model 2)
logistic preference human_dignity_concern age i.male income i.university_degree conservative

* Storing the estimates
estimates store E

* Running the logistic regression (Model 3)
logistic preference human_dignity_concern age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store F

* Generating a coefficient plot
coefplot D, bylabel(Model 1) || E, bylabel(Model 2) || F, bylabel(Model 3) ||, xline(1) eform  xtitle(Odds ratio) drop(_cons) coeflabels(human_dignity_concern = "Human dignity concern" age = "Age" 1.male = "Gender (male)" income = "Income" 1.university_degree = "University degree" conservative = "Conservative" robots_attitude = "Attitudes to robots" strikes_approval = "Drone strikes approval", wrap(20)) byopts(row(1) note("+ p < .1, * p < .05, ** p < .01, *** p < .001")) mlabposition(1) mlabel(cond(@pval<.001, "***", cond(@pval<.01, "**", cond(@pval<.05, "*", cond(@pval<.1, "+", ""))))) 

* Exporting the bar graph (Figure 6)
graph export F06.png

*** Figure 7 (interaction plot) - human dignity concern (IV) on LAWS preference (DV) by group (control, equal risk, unequal risk, highly unequal risk) ***

* Running the logistic regression (Model 4)
logistic preference c.human_dignity_concern##i.group_label if group!=3

* Obtaining the margins
margins group_label, at(human_dignity_concern=(1(0.1)6) ) 

* Generating an interaction plot
marginsplot, xlabel(1(1)6) recast(line) recastci(rarea) ciopt(color(%25)) xtitle("Human dignity concern") ytitle("Probability of LAWS preference") title("")

* Exporting the interaction plot (Figure 7)
graph export F07.png

*** Figure 8 (catplot) - perceived differences in human dignity ***

* Please refer to files rsv_ss_replication_data3 rsv_ss_replication_code3

************************************************
*** Replication of the results in Appendix 6 ***
************************************************

*** Appendix 6, Table 1 - age ***

* Obtaining summary statistics for the age variable
asdoc sum age, save(A06T01)

*** Appendix 6, Table 2 - gender ***

* Generating a labelled version of the male variable
recode male (0=0 "Female") (1=1 "Male"), generate(male_label)

* Obtaining summary statistics for the male variable
asdoc tab male_label, save(A06T02)

*** Appendix 6, Table 3 - income ***

* Generating a labelled version of the income variable
recode income (1=1 "Less than $10000") (2=2 "$10000 to $15999") (3=3 "$16000 to $19999") (4=4 "$20000 to $29999") (5=5 "$30000 to $39999") (6=6 "$40000 to $49999") (7=7 "$50000 to $59999") (8=8 "$60000 to $69999") (9=9 "$70000 to $79999") (10=10 "$80000 to $89999") (11=11 "$90000 to $99999") (12=12 "$100000 to $149999") (13=13 "More than $150000"), generate(income_label)

* Obtaining summary statistics for the income variable
asdoc tab income_label, save(A06T03)

*** Appendix 6, Table 4 - university degree ***

* Generating a labelled version of the education_bin variable
recode university_degree (0=0 "No university degree") (1=1 "University degree"), generate(university_degree_label)

* Obtaining summary statistics for the male variable
asdoc tab university_degree_label, save(A06T04)

*** Appendix 6, Table 5 - conservative ***

* Generating a labelled version of the conservative variable
recode conservative (1=1 "Very liberal") (2=2 "Liberal") (3=3 "Slightly liberal") (4=4 "Moderate") (5=5 "Slightly conservative") (6=6 "Conservative") (7=7 "Very conservative"), generate(conservative_label)

* Obtaining summary statistics for the conservative variable
asdoc tab conservative_label, save(A06T05)

*** Appendix 6, Table 6 - party ***

* Generating a labelled version of the party variable
* Note: Please note that this is our measure of political party identification, and not the quota measure used by the Prolific platform 
recode party (1=1 "Republican") (2=2 "Democrat") (3=3 "Independent") (4=4 "Other"), generate(party_label)

* Obtaining summary statistics for the party variable
asdoc tab party_label, save(A06T06)

************************************************
*** Replication of the results in Appendix 7 ***
************************************************

*** Appendix 7, Table 1 - logistic regression of LAWS preference (DV), experimental treatments (IVs) ***

* Running the logistic regression (Model 1)
logistic preference group_filter1

* Storing the estimates
estimates store A07T01M01

* Running the logistic regression (Model 2)
logistic preference group_filter2

* Storing the estimates
estimates store A07T01M02

* Running the logistic regression (Model 3)
logistic preference group_filter3

* Storing the estimates
estimates store A07T01M03

* Running the logistic regression (Model 4)
logistic preference group_filter1 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A07T01M04

* Running the logistic regression (Model 5)
logistic preference group_filter2 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A07T01M05

* Running the logistic regression (Model 6)
logistic preference group_filter3 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A07T01M06

* Running the logistic regression (Model 7)
logistic preference group_filter1 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A07T01M07

* Running the logistic regression (Model 8)
logistic preference group_filter2 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A07T01M08

* Running the logistic regression (Model 9)
logistic preference group_filter3 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A07T01M09

* Generating a table with results (Appendix 7, Table 1)
esttab A07T01M01 A07T01M02 A07T01M03 A07T01M04 A07T01M05 A07T01M06 A07T01M07 A07T01M08 A07T01M09 using A07T01.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(group_filter1 "Equal risk – Control" group_filter2 "Unequal risk – Equal risk" group_filter3 "Highly unequal risk – Unequal risk" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") order(group_filter1 group_filter2 group_filter3 age 1.male income 1.university_degree conservative robots_attitude strikes_approval _cons) drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 1: Logistic regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3" "Model 4" "Model 5" "Model 6" "Model 7" "Model 8" "Model 9")

*** Appendix 7, Table 2 - logistic regression of LAWS preference (DV), experimental treatments (IVs), MC pass subset ***

* Running the logistic regression (Model 1)
logistic preference group_filter1 if mc_pass==1

* Storing the estimates
estimates store A07T02M01

* Running the logistic regression (Model 2)
logistic preference group_filter2 if mc_pass==1

* Storing the estimates
estimates store A07T02M02

* Running the logistic regression (Model 3)
logistic preference group_filter3 if mc_pass==1

* Storing the estimates
estimates store A07T02M03

* Running the logistic regression (Model 4)
logistic preference group_filter1 age i.male income i.university_degree conservative if mc_pass==1

* Storing the estimates
estimates store A07T02M04

* Running the logistic regression (Model 5)
logistic preference group_filter2 age i.male income i.university_degree conservative if mc_pass==1

* Storing the estimates
estimates store A07T02M05

* Running the logistic regression (Model 6)
logistic preference group_filter3 age i.male income i.university_degree conservative if mc_pass==1

* Storing the estimates
estimates store A07T02M06

* Running the logistic regression (Model 7)
logistic preference group_filter1 age i.male income i.university_degree conservative robots_attitude strikes_approval if mc_pass==1

* Storing the estimates
estimates store A07T02M07

* Running the logistic regression (Model 8)
logistic preference group_filter2 age i.male income i.university_degree conservative robots_attitude strikes_approval if mc_pass==1

* Storing the estimates
estimates store A07T02M08

* Running the logistic regression (Model 9)
logistic preference group_filter3 age i.male income i.university_degree conservative robots_attitude strikes_approval if mc_pass==1

* Storing the estimates
estimates store A07T02M09

* Generating a table with results (Appendix 7, Table 2)
esttab A07T02M01 A07T02M02 A07T02M03 A07T02M04 A07T02M05 A07T02M06 A07T02M07 A07T02M08 A07T02M09 using A07T02.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(group_filter1 "Equal risk – Control" group_filter2 "Unequal risk – Equal risk" group_filter3 "Highly unequal risk – Unequal risk" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") order(group_filter1 group_filter2 group_filter3 age 1.male income 1.university_degree conservative robots_attitude strikes_approval _cons) drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 2: Logistic regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3" "Model 4" "Model 5" "Model 6" "Model 7" "Model 8" "Model 9")

*** Appendix 7, Table 3 - logistic regression of LAWS preference (DV), experimental treatments (IVs), sampling weights ***

* Running the logistic regression (Model 1)
logistic preference group_filter1 [pweight = weight]

* Storing the estimates
estimates store A07T03M01

* Running the logistic regression (Model 2)
logistic preference group_filter2 [pweight = weight]

* Storing the estimates
estimates store A07T03M02

* Running the logistic regression (Model 3)
logistic preference group_filter3 [pweight = weight]

* Storing the estimates
estimates store A07T03M03

* Running the logistic regression (Model 4)
logistic preference group_filter1 age i.male income i.university_degree conservative [pweight = weight]

* Storing the estimates
estimates store A07T03M04

* Running the logistic regression (Model 5)
logistic preference group_filter2 age i.male income i.university_degree conservative [pweight = weight]

* Storing the estimates
estimates store A07T03M05

* Running the logistic regression (Model 6)
logistic preference group_filter3 age i.male income i.university_degree conservative [pweight = weight]

* Storing the estimates
estimates store A07T03M06

* Running the logistic regression (Model 7)
logistic preference group_filter1 age i.male income i.university_degree conservative robots_attitude strikes_approval [pweight = weight]

* Storing the estimates
estimates store A07T03M07

* Running the logistic regression (Model 8)
logistic preference group_filter2 age i.male income i.university_degree conservative robots_attitude strikes_approval [pweight = weight]

* Storing the estimates
estimates store A07T03M08

* Running the logistic regression (Model 9)
logistic preference group_filter3 age i.male income i.university_degree conservative robots_attitude strikes_approval [pweight = weight]

* Storing the estimates
estimates store A07T03M09

* Generating a table with results (Appendix 7, Table 3)
esttab A07T03M01 A07T03M02 A07T03M03 A07T03M04 A07T03M05 A07T03M06 A07T03M07 A07T03M08 A07T03M09 using A07T03.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(group_filter1 "Equal risk – Control" group_filter2 "Unequal risk – Equal risk" group_filter3 "Highly unequal risk – Unequal risk" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") order(group_filter1 group_filter2 group_filter3 age 1.male income 1.university_degree conservative robots_attitude strikes_approval _cons) drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 3: Logistic regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3" "Model 4" "Model 5" "Model 6" "Model 7" "Model 8" "Model 9")

*** Appendix 7, Table 4 - OLS regression of LAWS preference (DV), experimental treatments (IVs) ***

* Running the logistic regression (Model 1)
regres preference group_filter1

* Storing the estimates
estimates store A07T04M01

* Running the logistic regression (Model 2)
regres preference group_filter2

* Storing the estimates
estimates store A07T04M02

* Running the logistic regression (Model 3)
regres preference group_filter3

* Storing the estimates
estimates store A07T04M03

* Running the logistic regression (Model 4)
regres preference group_filter1 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A07T04M04

* Running the logistic regression (Model 5)
regres preference group_filter2 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A07T04M05

* Running the logistic regression (Model 6)
regres preference group_filter3 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A07T04M06

* Running the logistic regression (Model 7)
regres preference group_filter1 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A07T04M07

* Running the logistic regression (Model 8)
regres preference group_filter2 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A07T04M08

* Running the logistic regression (Model 9)
regres preference group_filter3 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A07T04M09

* Generating a table with results (Appendix 7, Table 4)
esttab A07T04M01 A07T04M02 A07T04M03 A07T04M04 A07T04M05 A07T04M06 A07T04M07 A07T04M08 A07T04M09 using A07T04.rtf, noeqlines eqlabels(none) nogaps se r2 varlabels(group_filter1 "Equal risk – Control" group_filter2 "Unequal risk – Equal risk" group_filter3 "Highly unequal risk – Unequal risk" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") order(group_filter1 group_filter2 group_filter3 age 1.male income 1.university_degree conservative robots_attitude strikes_approval _cons) drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 4: OLS regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3" "Model 4" "Model 5" "Model 6" "Model 7" "Model 8" "Model 9")

************************************************
*** Replication of the results in Appendix 8 ***
************************************************

* Please refer to files rsv_ss_replication_data2 rsv_ss_replication_code2

************************************************
*** Replication of the results in Appendix 9 ***
************************************************

*** Appendix 9, Table 1 - logistic regression of LAWS preference (DV), experimental treatments (IVs) ***

* Running the logistic regression (Model 1)
logistic preference group_filter4

* Storing the estimates
estimates store A09T01M01

* Running the logistic regression (Model 2)
logistic preference group_filter4 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A09T01M02

* Running the logistic regression (Model 3)
logistic preference group_filter4 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A09T01M03

* Generating a table with results (Appendix 9, Table 1)
esttab A09T01M01 A09T01M02 A09T01M03 using A09T01.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(group_filter4 "Equal risk + responsibility – Equal risk" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 1: Logistic regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*** Appendix 9, Table 2 - logistic regression of LAWS preference (DV), experimental treatments (IVs), MC pass subset ***

* Running the logistic regression (Model 1)
logistic preference group_filter4 if mc_pass==1

* Storing the estimates
estimates store A09T02M01

* Running the logistic regression (Model 2)
logistic preference group_filter4 age i.male income i.university_degree conservative if mc_pass==1

* Storing the estimates
estimates store A09T02M02

* Running the logistic regression (Model 3)
logistic preference group_filter4 age i.male income i.university_degree conservative robots_attitude strikes_approval if mc_pass==1

* Storing the estimates
estimates store A09T02M03

* Generating a table with results (Appendix 9, Table 2)
esttab A09T02M01 A09T02M02 A09T02M03 using A09T02.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(group_filter4 "Equal risk + responsibility – Equal risk" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 2: Logistic regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*** Appendix 9, Table 3 - logistic regression of LAWS preference (DV), experimental treatments (IVs), sampling weights ***

* Running the logistic regression (Model 1)
logistic preference group_filter4 [pweight = weight]

* Storing the estimates
estimates store A09T03M01

* Running the logistic regression (Model 2)
logistic preference group_filter4 age i.male income i.university_degree conservative [pweight = weight]

* Storing the estimates
estimates store A09T03M02

* Running the logistic regression (Model 3)
logistic preference group_filter4 age i.male income i.university_degree conservative robots_attitude strikes_approval [pweight = weight]

* Storing the estimates
estimates store A09T03M03

* Generating a table with results (Appendix 9, Table 3)
esttab A09T03M01 A09T03M02 A09T03M03 using A09T03.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(group_filter4 "Equal risk + responsibility – Equal risk" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 3: Logistic regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*** Appendix 9, Table 4 - OLS regression of LAWS preference (DV), experimental treatments (IVs) ***

* Running the logistic regression (Model 1)
regres preference group_filter4

* Storing the estimates
estimates store A09T04M01

* Running the logistic regression (Model 2)
regres preference group_filter4 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A09T04M02

* Running the logistic regression (Model 3)
regres preference group_filter4 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A09T04M03

* Generating a table with results (Appendix 9, Table 4)
esttab A09T04M01 A09T04M02 A09T04M03 using A09T04.rtf, noeqlines eqlabels(none) nogaps se r2 varlabels(group_filter4 "Equal risk + responsibility – Equal risk" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 4: OLS regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*************************************************
*** Replication of the results in Appendix 10 ***
*************************************************

* Please refer to files rsv_ss_replication_data3 rsv_ss_replication_code3

*************************************************
*** Replication of the results in Appendix 11 ***
*************************************************

*** Appendix 11, Table 1 - logistic regression of LAWS preference (DV), human dignity concern (IV) ***

* Running the logistic regression (Model 1)
logistic preference human_dignity_concern 

* Storing the estimates
estimates store A11T01M01

* Running the logistic regression (Model 2)
logistic preference human_dignity_concern age i.male income i.university_degree conservative

* Storing the estimates
estimates store A11T01M02

* Running the logistic regression (Model 3)
logistic preference human_dignity_concern age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A11T01M03

* Generating a table with results (Appendix 11, Table 1)
esttab A11T01M01 A11T01M02 A11T01M03 using A11T01.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(human_dignity_concern "Human dignity concern" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 1: Logistic regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*** Appendix 11, Table 2 - logistic regression of LAWS preference (DV), human dignity concern (IV), MC pass subset ***

* Running the logistic regression (Model 1)
logistic preference human_dignity_concern if mc_pass==1

* Storing the estimates
estimates store A11T02M01

* Running the logistic regression (Model 2)
logistic preference human_dignity_concern age i.male income i.university_degree conservative if mc_pass==1

* Storing the estimates
estimates store A11T02M02

* Running the logistic regression (Model 3)
logistic preference human_dignity_concern age i.male income i.university_degree conservative robots_attitude strikes_approval if mc_pass==1

* Storing the estimates
estimates store A11T02M03

* Generating a table with results (Appendix 11, Table 2)
esttab A11T02M01 A11T02M02 A11T02M03 using A11T02.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(human_dignity_concern "Human dignity concern" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 2: Logistic regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*** Appendix 11, Table 3 - logistic regression of LAWS preference (DV), human dignity concern (IV), sampling weights ***

* Running the logistic regression (Model 1)
logistic preference human_dignity_concern [pweight = weight]

* Storing the estimates
estimates store A11T03M01

* Running the logistic regression (Model 2)
logistic preference human_dignity_concern age i.male income i.university_degree conservative [pweight = weight]

* Storing the estimates
estimates store A11T03M02

* Running the logistic regression (Model 3)
logistic preference human_dignity_concern age i.male income i.university_degree conservative robots_attitude strikes_approval [pweight = weight]

* Storing the estimates
estimates store A11T03M03

* Generating a table with results (Appendix 11, Table 3)
esttab A11T03M01 A11T03M02 A11T03M03 using A11T03.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(human_dignity_concern "Human dignity concern" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 3: Logistic regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*** Appendix 11, Table 4 - OLS regression of LAWS preference (DV), human dignity concern (IV) ***

* Running the logistic regression (Model 1)
regres preference human_dignity_concern

* Storing the estimates
estimates store A11T04M01

* Running the logistic regression (Model 2)
regres preference human_dignity_concern age i.male income i.university_degree conservative

* Storing the estimates
estimates store A11T04M02

* Running the logistic regression (Model 3)
regres preference human_dignity_concern age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A11T04M03

* Generating a table with results (Appendix 11, Table 4)
esttab A11T04M01 A11T04M02 A11T04M03 using A11T04.rtf, noeqlines eqlabels(none) nogaps se r2 varlabels(human_dignity_concern "Human dignity concern" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 4: OLS regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*** Appendix 11, Table 5 - logistic regression of LAWS preference (DV), human dignity concern + experimental treatments (IVs) ***

* Running the logistic regression (Model 1)
logistic preference human_dignity_concern i.group

* Storing the estimates
estimates store A11T05M01

* Running the logistic regression (Model 2)
logistic preference human_dignity_concern i.group age i.male income i.university_degree conservative

* Storing the estimates
estimates store A11T05M02

* Running the logistic regression (Model 3)
logistic preference human_dignity_concern i.group age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A11T05M03

* Generating a table with results (Appendix 11, Table 5)
esttab A11T05M01 A11T05M02 A11T05M03 using A11T05.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(human_dignity_concern "Human dignity concern" 2.group "Equal risk – Control" 3.group "Equal risk + responsibility – Control" 4.group "Unequal risk – Control" 5.group "Highly unequal risk – Control" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(0.male 0.university_degree 1.group) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 5: Logistic regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*************************************************
*** Replication of the results in Appendix 12 ***
*************************************************

*** Appendix 12, Table 1 - logistic regression of LAWS preference (DV), human dignity concern (IV), interaction with experimental treatments ***

* Running the logistic regression (Model 1)
logistic preference c.human_dignity_concern##i.group

* Storing the estimates
estimates store A12T01M01

* Running the logistic regression (Model 2)
logistic preference c.human_dignity_concern##i.group age i.male income i.university_degree conservative

* Storing the estimates
estimates store A12T01M02

* Running the logistic regression (Model 3)
logistic preference c.human_dignity_concern##i.group age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A12T01M03

* Generating a table with results (Appendix 11, Table 5)
esttab A12T01M01 A12T01M02 A12T01M03 using A12T01.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(human_dignity_concern "Human dignity concern" 5.group "Highly unequal risk" 4.group "Unequal risk" 3.group "Equal risk + responsibility" 2.group "Equal risk" 2.group#c.human_dignity_concern "Human dignity concern * Equal risk" 3.group#c.human_dignity_concern "Human dignity concern * Equal risk + responsibility" 4.group#c.human_dignity_concern "Human dignity concern * Unequal risk" 5.group#c.human_dignity_concern "Human dignity concern * Highly unequal risk" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(1.group 1.group#c.human_dignity_concern 0.male 0.university_degree) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 1: Logistic regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*** Appendix 12, Figure 1 (coefplot) - logistic regression of LAWS preference (DV), human dignity concern (IV) by experimental treatment ***

* Running the logistic regression (Model 1)
logistic preference c.human_dignity_concern if group==1

* Storing the estimates
estimates store A12T02M01

* Running the logistic regression (Model 2)
logistic preference c.human_dignity_concern if group==2

* Storing the estimates
estimates store A12T02M02

* Running the logistic regression (Model 3)
logistic preference c.human_dignity_concern if group==3

* Storing the estimates
estimates store A12T02M03

* Running the logistic regression (Model 4)
logistic preference c.human_dignity_concern if group==4

* Storing the estimates
estimates store A12T02M04

* Running the logistic regression (Model 5)
logistic preference c.human_dignity_concern if group==5

* Storing the estimates
estimates store A12T02M05

* Generating a coefficient plot (Appendix 12, Figure 1)
coefplot A12T02M01, bylabel(Control) || A12T02M02, bylabel(Equal risk) || A12T02M03, bylabel(Equal risk + responsibility) || A12T02M04, bylabel(Unequal risk) || A12T02M05, bylabel(Highly unequal risk) ||, pstyle(p1) xline(1) eform xtitle(Odds ratio) drop(_cons) coeflabels(human_dignity_concern = "Human dignity concern") byopts(col(1) note("+ p < .1, * p < .05, ** p < .01, *** p < .001")) legend(off) mlabposition(1) mlabel(cond(@pval<.001, "***", cond(@pval<.01, "**", cond(@pval<.05, "*", cond(@pval<.1, "+", ""))))) 

* Exporting the interaction plot (Appendix 12, Figure 1)
graph export A12F01.png

*************************************************
*** Replication of the results in Appendix 13 ***
*************************************************

* Please refer to files rsv_ss_replication_data3 rsv_ss_replication_code3

*************************************************
*** Replication of the results in Appendix 14 ***
*************************************************

* Please refer to files rsv_ss_replication_data3 rsv_ss_replication_code3

*************************************************
*** Replication of the results in Appendix 15 ***
*************************************************

*** Appendix 15, Figure 1 - ordinal LAWS preference across experimental conditions ***

* Generating a labelled version of the preference_ordinal variable
recode preference_ordinal (1=1 "Prefer RC drones") (2=2 "Prefer neither") (3=3 "Prefer LAWS"), generate(preference_ordinal_label)

* Generating a catplot of preference_ordinal over group
catplot preference_ordinal_label, over(group_label) stack asyvars perc(group_label) blabel(bar, size(medsmall) position(center) format(%9.0f)) ytitle("% of participants") l1title("")

* Exporting the interaction plot (Appendix 15, Figure 1)
graph export A15F01.png

*** Appendix 15, Figure 2 - LAWS preference across experimental conditions, subset of participants who chose "neither" ***

* Generating a labelled version of the preference variable
recode preference (0=0 "Prefer RC drones") (1=1 "Prefer LAWS"), generate(preference_label)

* Generating a catplot of preference_ordinal over group
catplot preference_label if preference_ordinal==2, over(group_label) stack asyvars perc(group_label) blabel(bar, size(medsmall) position(center) format(%9.0f)) ytitle("% of participants") l1title("")

* Exporting the interaction plot (Appendix 15, Figure 2)
graph export A15F02.png

*** Appendix 15, Table 1 - ordered logit regression of LAWS preference (DV), experimental treatments (IVs) ***

* Running the logistic regression (Model 1)
ologit preference_ordinal group_filter1

* Storing the estimates
estimates store A15T01M01

* Running the logistic regression (Model 2)
ologit preference_ordinal group_filter2

* Storing the estimates
estimates store A15T01M02

* Running the logistic regression (Model 3)
ologit preference_ordinal group_filter3

* Storing the estimates
estimates store A15T01M03

* Running the logistic regression (Model 4)
ologit preference_ordinal group_filter1 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A15T01M04

* Running the logistic regression (Model 5)
ologit preference_ordinal group_filter2 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A15T01M05

* Running the logistic regression (Model 6)
ologit preference_ordinal group_filter3 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A15T01M06

* Running the logistic regression (Model 7)
ologit preference_ordinal group_filter1 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A15T01M07

* Running the logistic regression (Model 8)
ologit preference_ordinal group_filter2 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A15T01M08

* Running the logistic regression (Model 9)
ologit preference_ordinal group_filter3 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A15T01M09

* Generating a table with results (Appendix 15, Table 1)
esttab A15T01M01 A15T01M02 A15T01M03 A15T01M04 A15T01M05 A15T01M06 A15T01M07 A15T01M08 A15T01M09 using A15T01.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(group_filter1 "Equal risk – Control" group_filter2 "Unequal risk – Equal risk" group_filter3 "Highly unequal risk – Unequal risk" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") order(group_filter1 group_filter2 group_filter3 age 1.male income 1.university_degree conservative robots_attitude strikes_approval _cons) drop(0.male 0.university_degree cut1 cut2) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 1: Ordered logit regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3" "Model 4" "Model 5" "Model 6" "Model 7" "Model 8" "Model 9")

*** Appendix 15, Table 2 - ordered logit regression of LAWS preference (DV), experimental treatments (IVs) ***

* Running the logistic regression (Model 1)
ologit preference_ordinal group_filter4

* Storing the estimates
estimates store A15T02M01

* Running the logistic regression (Model 4)
ologit preference_ordinal group_filter4 age i.male income i.university_degree conservative

* Storing the estimates
estimates store A15T02M02

* Running the logistic regression (Model 7)
ologit preference_ordinal group_filter4 age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A15T02M03

* Generating a table with results (Appendix 15, Table 2)
esttab A15T02M01 A15T02M02 A15T02M03 using A15T02.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(group_filter4 "Equal risk + responsibility – Equal risk" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(0.male 0.university_degree cut1 cut2) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 2: Ordered logit regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*** Appendix 15, Table 3 - ordered logit regression of LAWS preference (DV), human dignity concern (IV) ***

* Running the logistic regression (Model 1)
ologit preference_ordinal human_dignity_concern 

* Storing the estimates
estimates store A15T03M01

* Running the logistic regression (Model 2)
ologit preference_ordinal human_dignity_concern age i.male income i.university_degree conservative

* Storing the estimates
estimates store A15T03M02

* Running the logistic regression (Model 3)
ologit preference_ordinal human_dignity_concern age i.male income i.university_degree conservative robots_attitude strikes_approval

* Storing the estimates
estimates store A15T03M03

* Generating a table with results (Appendix 15, Table 3)
esttab A15T03M01 A15T03M02 A15T03M03 using A15T03.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(human_dignity_concern "Human dignity concern" age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" robots_attitude "Attitudes to robots" strikes_approval "Drone strikes approval" _cons "Constant") drop(0.male 0.university_degree cut1 cut2) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 3: Ordered logit regression of LAWS preference) nonumbers mlabels("Model 1" "Model 2" "Model 3")

*************************************************
*** Replication of the results in Appendix 16 ***
*************************************************

* Please refer to files rsv_ss_replication_data3 rsv_ss_replication_code3

*************************************************
*** Replication of the results in Appendix 17 ***
*************************************************

*** Appendix 17, Table 1 - ttest of age over survey_attrition ***
asdoc ttest age, by(survey_attrition), replace title(Table 1: T-test of age by survey attrition) save(A17T01)

*** Appendix 17, Table 2 - cross-tab of survey_attrition over male ***
asdoc tab survey_attrition male_label, title(Table 2: Cross-tabulations of survey attrition over male) exp row chi2 save(A17T02.rtf)

*** Appendix 17, Table 3 - cross_tab of survey_attrition over income ***
asdoc tab survey_attrition income_label, title(Table 3: Cross-tabulations of survey attrition over income) exp row chi2 save(A17T03.rtf)

*** Appendix 17, Table 4 - cross_tab of survey_attrition over university degree ***
asdoc tab survey_attrition university_degree_label, title(Table 4: Cross-tabulations of survey attrition over university degree) exp row chi2 save(A17T04.rtf)

*** Appendix 17, Table 5 - cross_tab of survey_attrition over political orientation ***
asdoc tab survey_attrition conservative_label, title(Table 5: Cross-tabulations of survey attrition over political orientation) exp row chi2 save(A17T05.rtf)

*** Appendix 17, Table 6 - cross_tab of survey_attrition over party affiliation ***
asdoc tab survey_attrition party_label, title(Table 6: Cross-tabulations of survey attrition over party affiliation) exp row chi2 save(A17T06.rtf)

*** Appendix 17, Table 7 - logistic regression of survey attrition (DV) ***
logit survey_attrition age i.male income i.university_degree conservative i.party

* Storing the estimates
estimates store A17T07M01

* Generating a table with results (Appendix 17, Table 7)
esttab A17T07M01 using A17T07.rtf, noeqlines eqlabels(none) eform nogaps se pr2 varlabels(age "Age" 1.male "Gender (male)" income "Income" 1.university_degree "University degree" conservative "Conservative" 2.party "Democrat – Republican" 3.party "Independent – Republican" 4.party "Other – Republican" _cons "Constant") drop(0.male 0.university_degree 1.party) mtitle("prefer LAWS" "prefer LAWS" "prefer LAWS") title(Table 7: Logistic regression of survey attrition) nonumbers mlabels("Model 1")

**********************************************
*** Continue with rsv_ss_replication_code2 ***
**********************************************